#!/bin/env python

import time
import cv2
import numpy as np

pic_path = "../resource/pic/img_001.jpg"
pic_path2 = "../resource/pic/img_003.jpg"
# windowName = pic_path

# cv2.namedWindow(windowName, cv2.WINDOW_NORMAL)
# cv2.resizeWindow(windowName, 1500, 500)
pic1 = cv2.imread(pic_path)
pic2 = cv2.imread(pic_path2)

print("pic1 shape:", pic1.shape)
print("pic1 size:", pic1.size)
print("pic1 dtype:", pic1.dtype)

print("pic2 shape:", pic2.shape)
print("pic2 size:", pic2.size)
print("pic2 dtype:", pic2.dtype)

new_pic1 = pic1[0:126, :200]
new_pic2 = pic2[0:126, :200]


img = cv2.bitwise_not(new_pic1)
cv2.imshow("bitwise_not", np.hstack((new_pic1, img)))

img = cv2.bitwise_and(new_pic1, new_pic2)
cv2.imshow("bitwise_and", np.hstack((new_pic1, new_pic2, img)))

img = cv2.bitwise_or(new_pic1, new_pic2)
cv2.imshow("bitwise_or", np.hstack((new_pic1, new_pic2, img)))

img = cv2.bitwise_xor(new_pic1, new_pic2)
cv2.imshow("bitwise_xor", np.hstack((new_pic1, new_pic2, img)))

while True:
    if cv2.waitKey(0) == ord('q'):
        break

print('销毁窗口')
cv2.destroyAllWindows()
